home *** CD-ROM | disk | FTP | other *** search
/ CGI How-To / CGI HOW-TO.iso / chap2 / 2_3 / testprot.pl < prev    next >
Encoding:
Perl Script  |  1996-06-15  |  661 b   |  36 lines

  1. #!/usr/bin/perl
  2.  
  3. # Access the environment variable by name
  4.  
  5. $server_protocol = $ENV{'SERVER_PROTOCOL'};
  6.  
  7. print "Content-type: text/plain\n\n";
  8.  
  9. # Split the information into name/revision strings
  10. # by splitting on the slash character.
  11.  
  12. ($name,$revision) = split('/', $server_protocol, 2);
  13.  
  14. # Test and use the variable.
  15.  
  16. if ($revision > 1.0)
  17. {
  18.         print "Your server is using a new HTTP protocol\n";
  19. }
  20. elsif ($revision == 1.0)
  21. {
  22.         print "Your server is using the current HTTP protocol\n";
  23. }
  24. elsif ($revision > 0.0)
  25. {
  26.     print "Your server is using the old HTTP protocol\n";
  27. }
  28. else
  29. {
  30.     print "Server protocol $server_protocol is unknown\n";
  31. }
  32.  
  33. #
  34. # end of testprot.pl
  35. #
  36.